package exception_;

public class TryCatchDetail01 {
    public static void main(String[] args) {
        try {
            Person person = new Person();
//            person = null;
            System.out.println(person.getName());
            int n1 = 2;
            int n2 = 0;
            System.out.println(n1 / n2);
        } catch (NullPointerException e){
            System.out.println("空指针异常" + e.getMessage());
        }catch (ArithmeticException e){
            System.out.println("算数异常" + e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
        }
    }
}

class Person{
    String name = "jack";

    String getName(){
        return this.name;
    }
}
